package z;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.Enumeration;
import java.util.Hashtable;

import 学生管理系统.ActionHandle;
import 学生管理系统.Person;

but5.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == but5) {
            frame1.setVisible(true);
            try {
                ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
                has = (Hashtable) in.readObject();
                in.close();
            } catch (Exception ee) {
            }
            if (has.isEmpty()) {
                show.append("目前还没有学生的信息记录！\n");
//append(s:String)向文本域的文本追加字符串，简单的说就像system.out.println()                  
} else {
                                    
            for (Enumeration enu = has.elements(); enu.hasMoreElements();) {
//存入内存的内容如果不经过遍历是显示不出来的
                    Person per = (Person) enu.nextElement();
                    String str = "  <学号>：" + per.getNum() + "\n" + "  <姓名>：" + per.getName() + "\n" + "  <学院>："
                            + per.getDor() + "\n" + "  <性别>：" + per.getAddress() + "\n" + "  <专业班级>："
                            + per.getSex() + "\n" + "<出生日期>：" + per.getDate() + "\n" + "  <政治面貌>："
                            + per.getPol() + "\n" + " <电话>：" + per.getPhone() + "\n" + "\n";
                    show.append(str);
                }
                String str2 = "------------------------------结束---------------------------------------------------"
                        + "\n";
                show.append(str2);
            }
        }
    }

});
but0.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == but0) {
            frame.setVisible(false);
            new ActionHandle();
        }
    }
});
